package com.rockxin.cat.activity;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.rockxin.cat.R;
import com.rockxin.cat.adapter.LendDetailsAdapter;
import com.rockxin.cat.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by cat on 18-3-1.
 * 活动列表
 */

public class LendDetailsActivity extends BaseActivity {


    @BindView(R.id.back_img)
    ImageView backImg;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.tv_top_title)
    TextView tvTopTitle;
    @BindView(R.id.tv_rate)
    TextView tvRate;
    @BindView(R.id.tv_term)
    TextView tvTerm;
    @BindView(R.id.tv_money)
    TextView tvMoney;
    @BindView(R.id.tv_estimated_rate_num)
    TextView tvEstimatedRateNum;
    @BindView(R.id.tv_money_type)
    TextView tvMoneyType;
    @BindView(R.id.tv_date)
    TextView tvDate;
    @BindView(R.id.tv_money_num)
    TextView tvMoneyNum;
    @BindView(R.id.tv_state)
    TextView tvState;
    @BindView(R.id.recyler_view)
    RecyclerView recylerView;

    private List<String> mList;
    private LendDetailsAdapter mAdapter;

    @Override
    protected int setLayout() {
        return R.layout.activity_lend_details;
    }

    @Override
    public void initData() {
        initView();
        initRecyclerView();
        setListener();
        getData();
    }

    public void initView() {
        title.setText("出借详情");
        tvMoneyType.setText("类别");
        tvDate.setText("合同还款期");
        tvMoneyNum.setText("金额");
        tvState.setText("状态");
    }

    private void initRecyclerView() {
        mList = new ArrayList<>();
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");
        mList.add("http://p2.wmpic.me/article/2017/02/23/1487816929_mLwPeYbD.jpg");

        mAdapter = new LendDetailsAdapter(R.layout.item_lend_details, mList);
        recylerView.setAdapter(mAdapter);

        final LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
        mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recylerView.setLayoutManager(mLayoutManager);
    }

    private void setListener() {
        backImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void getData() {

    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        finish();
    }
}
